package cn.fantasy.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * @author ET
 * @description 使用线程的线程池方法
 * @date 2023/3/10 15:09
 * @Version V1.0
 */
public class ThreadOrderFour {

    public static void main(String[] args) {
        final Thread thread1 = new Thread(() -> {
            System.out.println("one");
        });

        final Thread thread2 = new Thread(() -> {
            System.out.println("two");
        });

        final Thread thread3 = new Thread(() -> {
            System.out.println("three");
        });

        ExecutorService executorService = Executors.newSingleThreadExecutor();
        executorService.submit(thread1);
        executorService.submit(thread2);
        executorService.submit(thread3);
        executorService.shutdown();

    }
}
